import numpy as np
from sklearn.linear_model import Lasso
from sklearn.linear_model import SGDRegressor

X = 2 * np.random.rand(100,1)
Y = 4 + 3*X +np.random.randn(100,1)
lasso_reg = Lasso(alpha=0.1,max_iter=30000)
lasso_reg.fit(X,Y)
print(lasso_reg.predict([[1.5]]))
print(lasso_reg.intercept_)
print(lasso_reg.coef_)
sgd_reg = SGDRegressor(alpha=0.1,penalty="l1",max_iter=30000)
sgd_reg.fit(X,Y.ravel())
print(sgd_reg.predict([[1.5]]))
print(sgd_reg.intercept_)
print(sgd_reg.coef_)
